package com.soft.javase.day08.linklist;

import java.util.LinkedList;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/28
 */
public class SimulateStack {
    public static void main(String[] args) {

        LinkedList<Person> stack = new LinkedList<>();

        System.out.println("压栈操作:");
        stack.addFirst(new Person("张三", 25));
        stack.addFirst(new Person("李四", 30));
        stack.addFirst(new Person("王五", 28));

        System.out.println("当前堆栈: " + stack);

        System.out.println("弹栈操作:");
        while (!stack.isEmpty()) {
            Person p = stack.removeFirst();
            System.out.println("弹栈: " + p);
            System.out.println("剩余堆栈: " + stack);
        }
    }
}
